home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / Shutdown FX 1.3 Source / Shutdown FX ƒ / sfx wipes ƒ / Halves scroll.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-14  |  2.3 KB  |  76 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        Halves scroll.c
  4.  
  5. Purpose:    This module handles clearing the screen in a funky
  6.             manner.  See the comments below for more details.
  7.             
  8.  
  9. Shutdown FX -=- graphic effects on shutdown
  10. Copyright (C) 1993 Mark Pilgrim & Dave Blumenthal
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "msg timing.h"
  30.  
  31. #define        BoxSize        10
  32. #define CorrectTime 3
  33.  
  34. void HalvesScroll(GrafPtr thePtr, Pattern *thePattern, int width, int height);
  35.  
  36. /* 2 regions, split down the middle of the screen.  Scroll the screen up in one
  37.    region and down in the other. */
  38.    
  39. void HalvesScroll(GrafPtr thePtr, Pattern *thePattern, int width, int height)
  40. {
  41.     int                x;
  42.     Rect            topdest, bottomdest;
  43.     Rect            topscrollsource, topscrolldest;
  44.     Rect            bottomscrollsource, bottomscrolldest;
  45.     int                cx;
  46.     
  47.     cx = width / 2;
  48.  
  49.     SetRect(&topscrollsource, 0, 0, cx, height-BoxSize);
  50.     topscrollsource.right=cx;
  51.     topscrolldest = topscrollsource;
  52.     OffsetRect(&topscrolldest, 0, BoxSize);
  53.     
  54.     SetRect(&topdest, 0, 0, cx, BoxSize);
  55.     
  56.     SetRect(&bottomscrollsource, cx, BoxSize, width, height);
  57.     bottomscrolldest=bottomscrollsource;
  58.     OffsetRect(&bottomscrolldest, 0, -BoxSize);
  59.     
  60.     SetRect(&bottomdest, cx, height-BoxSize, width, height);
  61.     
  62.     for(x = height - BoxSize; x >= 0; x -= BoxSize)
  63.     {
  64.         StartTiming();
  65.         CopyBits(&(thePtr->portBits), &(thePtr->portBits),
  66.                 &topscrollsource, &topscrolldest, 0, 0L);
  67.         FillRect(&topdest, *thePattern);
  68.         
  69.         CopyBits(&(thePtr->portBits), &(thePtr->portBits),
  70.                 &bottomscrollsource, &bottomscrolldest, 0, 0L);
  71.         FillRect(&bottomdest, *thePattern);
  72.         
  73.         TimeCorrection(CorrectTime);
  74.     }
  75. }
  76.